<?php

namespace App\Http\Requests\Strator;

use Illuminate\Foundation\Http\FormRequest;

class StratorLoginRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'strator_account'=>'sometimes|min:5|max:30|alpha_num',
            'strator_mobile'=>'sometimes|min:10000000000|max:19999999999|integer',
            'strator_email'=>'sometimes|email',
            'strator_password'=>'required|min:6|max:20',
            // 'captcha_key'=>'required|min:8|max:50',
            // 'captcha_res'=>'required|min:1|max:100|numeric',
            // 'client_type'=>'required|min:1|max:100|alpha',
        ];
    }
    /**
     * Get the error messages for the defined validation rules.
     *
     * @return array<string, string>
     */
    public function messages(): array
    {
        return [
            'strator_account.min' => '账号长度要在6-30位之间',
            'strator_account.max' => '账号长度要在6-30位之间',
            'strator_account.alpha_num' => '账号只能包含字母和数字',

            'strator_mobile.min' => '手机号格式不正确',
            'strator_mobile.max' => '手机号格式不正确',
            'strator_mobile.integer' => '手机号格式不正确',

            'strator_email.email' => '邮箱格式不正确',

            'strator_password.required' => '密码为必填',
            'strator_password.min' => '密码长度要在8-20位之间',
            'strator_password.max' => '密码长度要在8-20位之间',

            'captcha_key.required' => '验证码key不能为空',

            'captcha_res.required' => '验证码计算结果不能为空',
            'captcha_res.min' => '验证码计算结果不正确',
            'captcha_res.max' => '验证码计算结果不正确',
            'captcha_res.numeric' => '验证码计算结果不正确',

            'client_type.required' => '客户端类型不能为空',
            'client_type.min' => '客户端类型格式不正确',
            'client_type.max' => '客户端类型格式不正确',
            'client_type.alpha' => '客户端类型格式不正确',
        ];
    }
}
